package com.hcc.gateway.domain.resp;

import lombok.Data;

/**
 * GatewayResp
 *
 * @author hushengjun
 * @date 2021/12/25
 */
@Data
public class GatewayResp<T> {

    private String traceId;
    private Boolean success;
    private String code;
    private String msg;
    private Long timestamp;
    private T data;


    public static <T> GatewayResp<T> success() {
        return success(null);
    }

    public static <T> GatewayResp<T> success(T data) {
        GatewayResp<T> resp = new GatewayResp<>();
        resp.setData(data);

        return resp;
    }

    public static <T> GatewayResp<T> failed(String msg) {
        return failed(601, msg);
    }

    public static <T> GatewayResp<T> failed(Integer code, String msg) {
        GatewayResp<T> resp = new GatewayResp<>();

        return resp;
    }

}
